//
//  ForgetPayPWVerifyController.m
//  HuLaQuan
//
//  Created by hok on 1/23/16.
//  Copyright © 2016 Jianghao. All rights reserved.
//

#import "ForgetPayPWVerifyController.h"

#import "CurrentUser.h"

//Jump To
#import "ForgetPayPWCardListController.h"
//Back To
#import "UserSecurityViewController.h"

@interface ForgetPayPWVerifyController ()


@end

@implementation ForgetPayPWVerifyController
#pragma mark - Navigation Back
- (void)goBackAction
{
    [[UIApplication sharedApplication].keyWindow endEditing:YES];
    UIAlertController *x = [UIAlertController alertWithTitle:@"提示" andMessage:@"是否放弃忘记支付密码操作" andBlock:^(UIAlertAction *action ) {
        if ([action.title isEqualToString:@"好的"]) {
            if ([self.navigationController.viewControllers[1] isKindOfClass:[UserSecurityViewController class]]) {
                [self.navigationController popToViewController:self.navigationController.viewControllers[1] animated:YES];
            }
        }
        
    }  type:@"confirmAndCancel"];
    [self presentViewController:x animated:YES completion:nil];
    
}
#pragma mark - Call Back
- (void)verifySMSFinish:(id)message
{
    NSLog(@"%@",message);
    NSLog(@"--- verify sms finish%@",message);

    [self.userInfo addEntriesFromDictionary:message];
    [self performSegueWithIdentifier:@"ShowCardListFromForgetPayVerify" sender:self];
}
#pragma mark - Life Cycle
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    self.smsVerifyEngine.smsType = SMSForgetPayPW;
    self.userInfo[@"userName"] = [CurrentUser sharedInstance].name;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    if([segue.identifier isEqualToString:@"ShowCardListFromForgetPayVerify"])
    {
        ForgetPayPWCardListController *xCon = (ForgetPayPWCardListController *) [segue destinationViewController];
        xCon.userInfoAndSMS = self.userInfo;
    }
}


@end
